/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JPanelList.java
 *
 * Created on Dec 5, 2011, 9:07:28 AM
 */
package management;

import java.io.File;
import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeSelectionModel;

/**
 *
 * @author buer
 */
public class JPanelList extends javax.swing.JPanel {

    /** Creates new form JPanelList */
    public JPanelList(JPanelTool jPanelTool) {
        this.jPanelTool = jPanelTool;
        initTree();
        initComponents();
    }

    private void initTree() {
        DefaultMutableTreeNode root = new DefaultMutableTreeNode("Vocabulary List");
        String[] files = getFiles();
        for(String file : files) {
            root.add(new DefaultMutableTreeNode(file));
        }
        model = new DefaultTreeModel(root);
    }
    
    /**
     * 获得dic文件夹下文件名，作为management左边栏List显示
     * @return 
     */
    private String[] getFiles() {
        String[] s = {"UserList"};
        return s;
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jTVocList = new javax.swing.JTree();

        setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true));
        setPreferredSize(new java.awt.Dimension(200, 300));

        jTVocList.setModel(model);
        jScrollPane1.setViewportView(jTVocList);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 174, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 274, Short.MAX_VALUE)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTree jTVocList;
    // End of variables declaration//GEN-END:variables
    private DefaultTreeModel model;
    private JPanelTool jPanelTool;
}
